home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume3 / dial.sample < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  3.4 KB

  1. From: "Oliver Laumann" <seismo!unido!tub!net>
  2. Subject: Example dial script.
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 3, Issue 123
  7. Submitted by: "Oliver Laumann" <seismo!unido!tub!net>
  8.  
  9.  
  10. I forgot to include the sample dial script in the dial distribution.
  11. I'm sorry about that.  Here it comes:
  12. --
  13. Oliver Laumann            net@DB0TUI6.BITNET            net@tub.UUCP
  14.  
  15. ------------------cut here------------------------
  16. #! /bin/sh
  17. # This is a shell archive, meaning:
  18. # 1. Remove everything above the #! /bin/sh line.
  19. # 2. Save the resulting text in a file.
  20. # 3. Execute the file with /bin/sh (not csh) to create the files:
  21. #    example
  22. # This archive created: Wed Feb 12 13:14:28 1986
  23. export PATH; PATH=/bin:$PATH
  24. echo shar: extracting "'example'" '(2386 characters)'
  25. if test -f 'example'
  26. then
  27.     echo shar: will not over-write existing file "'example'"
  28. else
  29. cat << \SHAR_EOF > 'example'
  30. # Example for a dial script.
  31. #
  32. # Connect to a remote UNIX machine through a PABX and obtain certain
  33. # information from a server account (`qomnews') on this machine.
  34. # The line through which the PABX can be accessed is defined in
  35. # /etc/remote under the name `pabx', thus...
  36.  
  37. line=pabx
  38.  
  39. # If the PABX receives ^A^B+, it responds with D+ indicating that
  40. # it is ready to accept a phone number.
  41. # Due to a bug in the PABX software, it sometimes responds with
  42. # two beeps; In this case, there is nothing we can do exept quit
  43. # and fix it by hand...
  44.  
  45. prolog \1\2+ 1
  46.     dial  D+
  47.     exit  \7\7  "Go buy a new PABX!\n"
  48.     exit  #     "No response from PABX.\n"
  49.  
  50. # Send the phone number of the remote UNIX machine.  Sleep 0.1 seconds
  51. # before actually transmitting the number (otherwise the PABX gets angry).
  52. # If we receive a V followed by a three-digit number and a plus sign,
  53. # the connection has been established successfully.  Several responses
  54. # of the form <letter>+ are used by the PABX to indicate that something
  55. # went wrong; these reponses are translated into useful messages.
  56.  
  57. dial 618\r 5,.1
  58.     exit  B+    "Port busy -- try later.\n"
  59.     exit  N+    "Out of order.\n"
  60.     exit  E+    "Invalid phone number.\n"
  61.     connected  V...+
  62.     exit  #      "Connection failed.\n"
  63.  
  64. # Transmit a carriage return in order to get the login prompt.
  65.  
  66. connected \r 5,.1
  67.     login "login: "
  68.     exit  #      "Login failed.\n"
  69.  
  70. # Login at the remote machine using the login name `qomnews'.
  71.  
  72. login qomnews\r
  73.     enter "name? "
  74.     exit  #      "QOM news server down.\n"
  75.  
  76. # The qomnews server prompts for a user name.  The name is obtained
  77. # from the file .qomid from the caller's home directory.
  78. # Note that a time-out of 15 seconds is scheduled in order to give
  79. # the server a resonable time for the response.
  80. # If all goes well, the server transmits a number of lines of the form
  81. #    You have <n> unseen letters
  82. #    You have <n> unseen entries in XYZ   
  83. # or simply
  84. #    You have seen all the news.
  85. # If the first `You' has been received, enter the `data' loop below.
  86.  
  87. enter "${~/.qomid}" 15
  88.     data \r\n\r\nYou You
  89.     exit O+     "Early disconnect."
  90.     exit #       "QOM news server is hung.\n"
  91.  
  92. # Print all data received from the remote machine on standard output
  93. # until either a time-out of 5 seconds occurs or the disconnect message
  94. # O+ is received.
  95.  
  96. data "" 5
  97.     exit O+
  98.     data * &
  99. SHAR_EOF
  100. if test 2386 -ne "`wc -c < 'example'`"
  101. then
  102.     echo shar: error transmitting "'example'" '(should have been 2386 characters)'
  103. fi
  104. fi # end of overwriting check
  105. #    End of shell archive
  106. exit 0
  107.  
  108.